package experiment.e05.code.ch04.v0;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/10/13 16:02
 * @package experiment.e05.code.ch04.v0
 * @description 文件说明
 */

public class Rectangle extends Point {
    // 实例变量: 长和宽
    private double l;
    private double w;

    // 构造方法
    public Rectangle() {
    }

    public Rectangle(double l, double w) {
        this.l = l;
        this.w = w;
    }

    // get && set
    public double getL() {
        return l;
    }

    public void setL(double l) {
        this.l = l;
    }

    public double getW() {
        return w;
    }

    public void setW(double w) {
        this.w = w;
    }

    /**
     * 获取面积
     *
     * @return
     */
    public double getArea() {
        return l * w;
    }

    @Override
    public String toString() {
        return "Rectangle:{" + "l=" + l + ", w=" + w + super.toString() + "} ";
    }
}
